#ifndef __FOUNDATION_H_
#define __FOUNDATION_H_



#include "Translate.h"

class DECLSPEC CFoundation
{
public:
    /**
     * static function, check the location is big endian or little endian
     * @return : If return true, mean location is big endian. If not, is
     *           little endian
     */
     static bool CheckEndian();

     /**
      * static function, translate ipv4 string to network 
      * @param strIP : The ip address string
      * @return : Network byte value. If translate error, return -1
      */
     static unsigned int IPv4ToLong(const std::string strIP);

     /**
      * static function, translate network to ipv4 string
      * @param nIp : The network endian value
      * @return : The Ipv4 string. If translate error, return "-1"
      */
     static std::string LongToIPv4(const unsigned int nIp);

     /**
      * Split the string with separator
      * @param strSplit : Split string
      * @param strTag : Split string with separator
      * @return : Split result
      */
     static std::vector<std::string> SplitString(const std::string strSplit, const std::string strTag);

     /**
      * Erase the string begin and end with strTag
      * @param strTrim : Trim string
      * @param strTag : Trim string in strTag
      * @param nSize : The number that you want to trim with strTrim. If it is -1, erase until find char 
      *                not in strTag
      */
     static void TrimBothEnds(std::string strTrim, const std::string strTag, size_t nSize);

};

#endif // !__FOUNDATION_H_